﻿
Ext.define('SHApp.System.MenuManage.Grid', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.menumanagegrid',
    requires: ['SHApp.System.MenuManage.ModTree', 'SHApp.System.Functions.Grid', 'SHApp.System.MetaData.Grid1'],
    layout: { type: "border" },
    MenuManageModTree: null,
    MenuManageFucGrid: null,
    MetaDataGrid: null,
    pvalue: 0,
    initComponent: function () {
        var me = this;
        Ext.apply(this);
        this.createItem(); //初始化分页条
        this.callParent(arguments);
    },
    createItem: function () {
        var me = this;
        var MenuManageModTree = Ext.create("SHApp.System.MenuManage.ModTree", { title: "模块管理", width: 220, pvalue: me.pvalue, split: true,
            region: "west"
        });

        MenuManageModTree.on("selectionchange", function (model, records) {
            var moduleID = "";
            if (records.length > 0) {
                moduleID = records[0].data.id;
                me.MenuManageFucGrid.loadByModuleID(moduleID);
            }
        });

        this.MenuManageModTree = MenuManageModTree;

        var MenuManageFucGrid = Ext.create("SHApp.System.Functions.Grid", {
            title: "功能管理",
            flex: 1,
            region: "center",
            pvalue: me.pvalue
        });
        MenuManageFucGrid.on("selectionchange", function (model, records) {
            var funcID = "";
            if (records.length > 0) {
                funcID = records[0].data.Id;
                me.MetaDataGrid.loadByFuncID(funcID);
            }
        });
        me.MenuManageFucGrid = MenuManageFucGrid;

        var MetaDataGrid = Ext.create('SHApp.System.MetaData.Grid1', {
            title: "权限分配",
            width: 150,
            split: true,
            funcGrid: me.MenuManageFucGrid,
            region: "east",
            pvalue: me.pvalue
        });
        me.MetaDataGrid = MetaDataGrid;

        me.items = [me.MenuManageModTree, me.MenuManageFucGrid, me.MetaDataGrid];
    }
})

